export default function (msg, duration = 3000) {
  const toast = document.createElement('div')
  toast.style.position = 'fixed'
  toast.style.padding = '5px 15px'
  toast.style.fontSize = '12px'
  toast.style.color = '#fff'
  toast.style.backgroundColor = '#000'
  toast.style.boxShadow = '0px 0px 2px #2b2b2b'
  toast.style.borderRadius = '3px'
  toast.style.left = '50%'
  toast.style.top = '50%'
  toast.style.transform = 'translate(-50%, -50%)'
  toast.style.zIndex = '999'
  toast.style.cursor = 'default'
  toast.textContent = msg

  document.body.appendChild(toast)

  setTimeout(() => {
    document.body.removeChild(toast)
  }, duration)
}
